// import logo from './logo.svg'
import './App.scss'
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'

import Home from './routes/home/index'

// function Home() {
//   return (
//     <div className="App">
//       <header className="App-header">
//         <img src={logo} className="App-logo" alt="logo" />
//         <p>
//           Edit <code>src/App.js</code> and save to reload.
//         </p>
//         <a
//           className="App-link"
//           href="https://reactjs.org"
//           target="_blank"
//           rel="noopener noreferrer"
//         >
//           Learn React
//         </a>
//       </header>
//     </div>
//   )
// }

function Test() {
  return <p>Test</p>
}

function User() {
  return <p>User</p>
}

function SignIn() {
  return <p>登录</p>
}

function NotFound() {
  return <p>404</p>
}

const isSignedIn = true

function App() {
  return (
    <BrowserRouter>
      <Switch>
        <Route path="/sign-in" exact component={SignIn}></Route>
        <Route path="/test" exact component={Test}></Route>
        <Route
          exact
          path="/user"
          render={() => (isSignedIn ? <User /> : <Redirect to="/sign-in" />)}
        ></Route>
        <Route path="/" exact component={Home}></Route>
        <Route component={NotFound}></Route>
      </Switch>
    </BrowserRouter>
  )
}

export default App
